package com.ruoyi.web.controller.system;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import javax.websocket.server.PathParam;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessStatus;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.utils.Constans;
import com.ruoyi.common.utils.PlanGenner;
import com.ruoyi.common.utils.PlanGennerItem;
import com.ruoyi.common.utils.PropertiesConst;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.system.domain.HatchetAcq;
import com.ruoyi.system.domain.HatchetAgent;
import com.ruoyi.system.domain.HatchetIssBank;
import com.ruoyi.system.domain.HatchetMerchant;
import com.ruoyi.system.domain.HatchetMerchantIncreaseLimit;
import com.ruoyi.system.domain.HatchetPlan;
import com.ruoyi.system.domain.HatchetPlanItem;
import com.ruoyi.system.domain.HatchetSystemConfig;
import com.ruoyi.system.service.IHatchetAcqService;
import com.ruoyi.system.service.IHatchetAgentService;
import com.ruoyi.system.service.IHatchetIssBankService;
import com.ruoyi.system.service.IHatchetMerchantIncreaseLimitService;
import com.ruoyi.system.service.IHatchetMerchantService;
import com.ruoyi.system.service.IHatchetPlanItemService;
import com.ruoyi.system.service.IHatchetPlanService;
import com.ruoyi.system.service.IHatchetSystemConfigService;
import com.ruoyi.system.vo.cpc.CpcUtils;
import com.ruoyi.system.vo.weishuapay.CityUtil;
import com.ruoyi.system.vo.weishuapay.FrontProductBean;
import com.ruoyi.system.vo.weishuapay.ProductBean;
import com.ruoyi.system.vo.weishuapay.ProductUtil;
import com.ruoyi.system.vo.weishuapay.RegionBean;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * 还款计划 代理商的操作
 * 
 * @author ruoyi
 * @date 2019-03-01
 */
@Controller  
@RequestMapping("/system/hatchetPlanForDLS")
public class HatchetPlanForDLSController extends BaseController
{
    private String prefix = "system/hatchetPlan";
	
	@Autowired
	private IHatchetPlanService hatchetPlanService;
	@Autowired
	private IHatchetMerchantIncreaseLimitService limtService;
	@Autowired
	private IHatchetAcqService acqService;
	@Autowired
	private IHatchetIssBankService issBankService;
	@Autowired
	private IHatchetMerchantService merchantService;
	@Autowired
	private IHatchetSystemConfigService systemConfigService;
	@Autowired
	private IHatchetPlanItemService itemService;
	@Autowired
	private IHatchetAgentService agentService;
	@RequiresPermissions("system:hatchetPlan:view")
	@GetMapping()
	public String hatchetPlan()
	{
	    return prefix + "/hatchetPlanForDLS";
	}
	//经理人查看的计划页面
	@GetMapping("/JLR")
	public String hatchetPlanForJLR() {
		return prefix + "/hatchetPlanForJLR";
	}
	
	/**
	 * 查询还款计划列表
	 */
	@RequiresPermissions("system:hatchetPlan:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(HatchetPlan hatchetPlan)
	{	
		//初始化计划总金额
		BigDecimal sumMoney = new BigDecimal("0");
		String loginName = getLoginName();
		List<HatchetPlan> list = new ArrayList<>();
		//是经理人用户
		if (loginName.length()>7) {
			HatchetMerchant merchant = merchantService.selectHatchetMerchantByNo(loginName);
			if (StringUtils.isNotNull(merchant)) {
				//查询经理人提交的计划
				hatchetPlan.setBrokerId(merchant.getID());
				if (StringUtils.isNotEmpty(hatchetPlan.getPhone())) {
					//通过手机号查询用户
					HatchetMerchant hatchetMerchant = new HatchetMerchant();
					hatchetMerchant.setPHONE(hatchetPlan.getPhone());
					List<HatchetMerchant> selectHatchetMerchantList = merchantService.selectHatchetMerchantList(hatchetMerchant);
					if (StringUtils.isNotEmpty(selectHatchetMerchantList)) {
						hatchetPlan.setMerchantId(selectHatchetMerchantList.get(0).getID());
					} else {
						return getDataTable(new ArrayList<>());
					}
				}
			} else {
				  return getDataTable(new ArrayList<>());
			}
			startPage();
			list = hatchetPlanService.selectHatchetPlanList(hatchetPlan);
			sumMoney = hatchetPlanService.selectPlanSumMoney(hatchetPlan);
	        
		//代理商
		} else {
			if (StringUtils.isNotEmpty(hatchetPlan.getMerchantNo()) || StringUtils.isNotEmpty(hatchetPlan.getMerchantName())) {
				HatchetMerchant paramMerchant = new HatchetMerchant();
				paramMerchant.setMerchantNo(hatchetPlan.getMerchantNo());
				paramMerchant.setMerchantCnName(hatchetPlan.getMerchantName());
				List<HatchetMerchant> selectHatchetMerchantList = merchantService.selectHatchetMerchantList(paramMerchant);
				if (StringUtils.isNotEmpty(selectHatchetMerchantList)) {
					hatchetPlan.setMerchantId(selectHatchetMerchantList.get(0).getID());
				}else {
					return getDataTable(new ArrayList<>());
				}
			}
			HatchetAgent agent = agentService.selectHatchetAgentByNo(loginName);
			String agentDepartmentCode = agent.getDepartmentCode();
			String likeDepartmentCode = StringUtils.likeDepartmentCode(agentDepartmentCode);
			hatchetPlan.setDepartmentCode(likeDepartmentCode);
			startPage();
	        list = hatchetPlanService.selectHatchetPlanForDLS(hatchetPlan);
	        sumMoney = hatchetPlanService.selectPlanDLSSumMoney(hatchetPlan);
		}
		int index = 0;
        for (HatchetPlan hatchetPlan2 : list) {
        	if (index == 0) {
        		hatchetPlan2.setSumMoney(sumMoney);
        		index++;
			}
        	//1)封装银行卡卡号和银行名称
        	if (StringUtils.isNotEmpty(hatchetPlan2.getID())) {
        		HatchetPlanItem item = new HatchetPlanItem();
    			item.setPlanId(hatchetPlan2.getID());
    			List<HatchetPlanItem> itemList = itemService.selectHatchetPlanItemList(item);
    			if (itemList.size() > 2) {
    				HatchetPlan hatchetPlan3 = hatchetPlanService.selectBankNameById(hatchetPlan2.getID());
            		if (hatchetPlan3 != null) {
                		hatchetPlan2.setBankName(hatchetPlan3.getBankName());
                		if (StringUtils.isNotEmpty(hatchetPlan3.getCardNo())) {
                			hatchetPlan2.setCardNo(StringUtils.idCardNoString(hatchetPlan3.getCardNo(),4));
        				}
        			}
    			}
        		
        	}
        	//2)借用backId字段封装大计划执行进度 
        	double planProgress = hatchetPlanService.selectPlanProgress(hatchetPlan2.getID());
        	hatchetPlan2.setBackId((int)(planProgress*100)+"");
        	//3）
        	String merchantId = hatchetPlan2.getMerchantId();
        	HatchetMerchant merchant = merchantService.selectHatchetMerchantById(merchantId);
        	if (StringUtils.isNotNull(merchant)) {
        		//借用sourceItem字段封装用户手机号
        		hatchetPlan2.setSourceItem(merchant.getPHONE());
			}
        }
        return getDataTable(list);
	}
	
	/**
	 * 跳转经理人添加计划页面
	 * id 信用卡id
	 */
	@GetMapping("/addPalnByJLR/{id}")
	public String  addPalnByJLR(@PathVariable String id,ModelMap map)
	{	
		HatchetMerchantIncreaseLimit  increaseLimit = limtService.selectHatchetMerchantIncreaseLimitById(id);
		HatchetIssBank issBank = issBankService.selectHatchetIssBankByBankCode(increaseLimit.getBankName());
		if (StringUtils.isNotNull(issBank)) {
			increaseLimit.setBankName(issBank.getShortCnName());
		} else {
			increaseLimit.setBankName(null);
		}
		increaseLimit.setBankAccount(StringUtils.idCardNoString(increaseLimit.getBankAccount(),4));
		map.put("increaseLimit", increaseLimit);
		return prefix+"/addByJLR";
	}
	
	/**
	 *查询通道
	 */
	@PostMapping("/getAcq")
	@ResponseBody
	public Map<String,Object> getAcq(HatchetPlan hatchetPlan)
	{	
		HatchetMerchantIncreaseLimit limit = limtService.selectHatchetMerchantIncreaseLimitById(hatchetPlan.getLimitId());
		Map<String,Object> map = new HashMap<>();
		
		// 根据预估费率，计算出预估周转金
		BigDecimal calculateZhj = null;
		String day = hatchetPlan.getTimes();
		try {
			/*if ("".equals(day)) {
				map.put("status", BusinessStatus.FAIL);
				map.put("msg", "选择还款日期！");
				return map;
			}
			String[] times_ = day.split(",");
			if (times_.length<2) {
				map.put("status", BusinessStatus.FAIL);
				map.put("msg", "还款日期不能低于2天,请从新选择日期！");
				return map;
			}*/
			calculateZhj = PlanGenner.calculateZhj(hatchetPlan.getPlanAmt().toString(), hatchetPlan.getTimes(),hatchetPlan.getEveryNum().toString(),new BigDecimal(Constans.MAX_RATE));
			System.out.println("周转金:" + calculateZhj);
		} catch (Exception e1) {
			map.put("status", BusinessStatus.FAIL);
			map.put("msg", "请调整还款金额或还款日期重新计算，可能原因是还款金额过少且还款天数过多！");
			return map;
		}
		BigDecimal bigMoney = new BigDecimal("1000"); // 落地的最大金额
  		// 这里根据周转金大小，判定是该走大额通道还是小额通道 注：BigDecimal compareTo(val) 小于val返回-1 | 大于val 返回1 |等于val返回0
		boolean issmall = calculateZhj.compareTo(bigMoney) < 1;
		HatchetAcq acq = new HatchetAcq();
		acq.setEmployStatus("10A");
		String acqType ="";
		//走小额
		if(issmall) {
			acq.setRspcdRevert("0.3");
			acqType ="小额";
		//走大额	
		}else {
			acq.setRspcdRevert("0.4");
			acqType ="大额";
		}
		List<HatchetAcq> acqList = acqService.selectHatchetAcqList(acq);
		Map<String, String> acqMap = new HashMap<>();
		for (HatchetAcq hatchetAcq : acqList) {
			acqMap.put(hatchetAcq.getAcqCode(), hatchetAcq.getProcesscdResign());
		}
		HatchetIssBank issBank = issBankService.selectHatchetIssBankByBankCode(limit.getBankName());
		
		//查询当前卡支持的通道的code集合
		String searchAcqCode = PlanGenner.searchAcqCode(acqMap, issBank.getShortCnName());
		if (StringUtils.isEmpty(searchAcqCode)) {
			map.put("status", BusinessStatus.FAIL);
			map.put("msg", "您的银行不支持相关通道，请咨询客服！");
			return map;
		}
		//当前银行卡支持的通道
		List<HatchetAcq> validAcqs = new ArrayList<>();
		for (HatchetAcq hatchetAcq : acqList) {
			acqMap.put(hatchetAcq.getAcqCode(), hatchetAcq.getProcesscdResign());
			String[] acqCodes = searchAcqCode.split(",");
			for (int i = 0; i < acqCodes.length; i++) {
				if(hatchetAcq.getAcqCode().equals(acqCodes[i])) {
					if (StringUtils.isNotEmpty(limit.getSTATUS())) {
						if(limit.getSTATUS().contains(hatchetAcq.getAcqCode())) {
							hatchetAcq.setFeeStatus("Y");//已开通
						}else {
							hatchetAcq.setFeeStatus("N");//未开通
						}
					} else {
						hatchetAcq.setFeeStatus("N");//没有任何通道
					}
					
					
					validAcqs.add(hatchetAcq);
				}
			}
		}
		map.put("status", BusinessStatus.SUCCESS);
		map.put("acqList", validAcqs);
		map.put("acqType", acqType);
		return map;
	}
	
	
	
	/**
	 *查询还款计划费用
	 *//*
	@PostMapping("/selectFee")
	@ResponseBody
	public Map<String,Object> selectFee(HatchetPlan hatchetPlan,@PathParam(value = "acqCode") String acqCode)
	{	
		Map<String,Object> map = new HashMap<>();
		try {
			HatchetMerchant merchant = new 	HatchetMerchant();
			HatchetMerchantIncreaseLimit limit = limtService.selectHatchetMerchantIncreaseLimitById(hatchetPlan.getLimitId());
			if (StringUtils.isNotNull(limit)) {
				merchant = merchantService.selectHatchetMerchantById(limit.getMerchantId());
				if (StringUtils.isNull(merchant)) {
					map.put("status", BusinessStatus.FAIL);
					map.put("msg", "查不到用户信息！");
					return map;
				}
			}else {
				map.put("status", BusinessStatus.FAIL);
				map.put("msg", "查不到信用卡信息！");
				return map;
			}
			limit.getMerchantId();
			//获得当前落地费率
			BigDecimal rate = getRate(hatchetPlan.getAcqCode(),merchant.getLEVEL());
			Map<String, Object> grennerPlan = PlanGenner.grennerPlan(hatchetPlan.getPlanAmt().toString(), hatchetPlan.getTimes(),
					hatchetPlan.getEveryNum().toString(),rate);
			//>>>>>>>>>>>>>>>>{times_money=9.00, rate_money=15.80, sale_min=177.00, plan_time=2019/04/26 - 2019/04/30, sale_max=275.08, total_free=25.08, free_free=0.28, 
			//items=[sale:1:2019-04-26 17:18:26:275.08, payment:1:2019-04-26 18:58:42:250, sale:2:2019-04-27 09:04:14:216, payment:2:2019-04-27 11:55:44:216, sale:3:2019-04-27 14:36:03:222, payment:3:2019-04-27 16:49:44:220, sale:4:2019-04-28 09:00:56:225, payment:4:2019-04-28 12:03:24:219, sale:5:2019-04-28 14:18:49:218, payment:5:2019-04-28 16:16:39:223, sale:6:2019-04-29 09:37:26:233, payment:6:2019-04-29 11:09:25:229, sale:7:2019-04-29 14:34:52:235, payment:7:2019-04-29 16:36:52:226, sale:8:2019-04-30 09:28:05:224, payment:8:2019-04-30 11:47:27:239, sale:9:2019-04-30 14:14:32:177, payment:9:2019-04-30 15:15:49:178], 
			//total_zhj=275.08}

			map.put("times_money", grennerPlan.get("times_money"));//笔数费
			map.put("rate_money", grennerPlan.get("rate_money"));//费率手续费
			map.put("sale_min", grennerPlan.get("sale_min"));//最小消费金额
			map.put("sale_max", grennerPlan.get("sale_max"));//最大消费金额
			map.put("total_free", grennerPlan.get("total_free"));//费用总和
			map.put("free_free", grennerPlan.get("free_free"));//手续费的手续费
			map.put("saletotal", grennerPlan.get("saletotal"));//最终消费金额
			map.put("paytotal", grennerPlan.get("paytotal"));//最终还款金额
			map.put("items", grennerPlan.get("items"));
			map.put("rate", rate);//当前费率
			map.put("status", BusinessStatus.SUCCESS);
			System.out.println(">>>>>>>>>>>>>>>>"+grennerPlan.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}
	*/
	/**
	 *计划详情预览
	 */
	@PostMapping("/viewPlanItem")
	@ResponseBody
	public Map<String,Object> viewPlanItem(HatchetPlan hatchetPlan,@PathParam(value = "city") String city)
	{	
		Map<String,Object> map = new HashMap<>();
		try {
			HatchetMerchant merchant = new 	HatchetMerchant();
			HatchetMerchantIncreaseLimit limit = limtService.selectHatchetMerchantIncreaseLimitById(hatchetPlan.getLimitId());
			if (StringUtils.isNotNull(limit)) {
				merchant = merchantService.selectHatchetMerchantById(limit.getMerchantId());
				if (StringUtils.isNull(merchant)) {
					map.put("status", BusinessStatus.FAIL);
					map.put("msg", "查不到用户信息！");
					return map;
				}
			}else {
				map.put("status", BusinessStatus.FAIL);
				map.put("msg", "查不到信用卡信息！");
				return map;
			}
			
			map.put("merchantId", merchant.getID());
			map.put("42",merchant.getMerchantNo().toString());//用户编号
			map.put("422",city);//城市
			map.put("8",hatchetPlan.getPlanAmt().toString());//还款金额
			map.put("10",hatchetPlan.getTimes());//时间字符串
			map.put("7",hatchetPlan.getEveryNum().toString());//每天笔数
			map.put("11",limit.getBankAccount());//银行卡号
			map.put("12",limit.getID());//信用卡id
			Map<String, Object> createPlan = createPlan(map, hatchetPlan.getAcqCode());
			return  createPlan;
		
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}
	
	
	/**
	 *提交计划
	 */
	@PostMapping("/submitPlan")
	@ResponseBody
	 @Log(title = "经理人提交计划", businessType = BusinessType.INSERT)
	public Map<String,Object> submitPlan(@PathParam(value="plan")String plan)
	{	
		Map<String, Object> map = new HashMap<>();
		try {
			map = hatchetPlanService.submitPlan(plan,getLoginName());
		} catch (Exception e) {
			map.put("status", BusinessStatus.FAIL);
			map.put("msg", e.getMessage());
			e.printStackTrace();
		}
		return map;
	}
	
	/**
	 *取消计划
	 */
	@GetMapping("/cancelPlan")
	@ResponseBody
	 @Log(title = "经理人取消计划", businessType = BusinessType.DELETE)
	public Map<String,String> cancelPlan(@PathParam(value="planId")String planId)
	{	
		HatchetMerchant merchant = merchantService.selectHatchetMerchantByNo(getLoginName());
		Map<String, String> map = new HashMap<>();
		String params = "pid="+planId+"&uid="+merchant.getID()+"&sign="+StringUtils.getSign();
		String result = HttpUtils.sendGet(Constans.CANCEL_PLAN_URL, params);
		JSONObject fromObject = JSONObject.fromObject(result);
		map = (Map<String,String>)fromObject;
		return map;
	}
	
	/**
	 *申请开通通道
	 */
	@PostMapping("/openAcq")
	@ResponseBody
	public Map<String,String> openAcq( HatchetPlan hatchetPlan )
	{	
		Map<String, String> map = new HashMap<>();
		String params = "cardid="+hatchetPlan.getLimitId()+"&acqcode="+hatchetPlan.getAcqCode()+"&sign="+StringUtils.getSign();
		String result = HttpUtils.sendGet(Constans.BEFORE_OPEN_ACQ_URL, params);
		JSONObject fromObject = JSONObject.fromObject(result);
		map = (Map<String, String>)fromObject;
		return  map;
	}
	
	//绑定通道
	@PostMapping("/bindAcq")
	@ResponseBody
	 @Log(title = "经理人绑定通道", businessType = BusinessType.INSERT)
	/**
	 * @param map
	 * key1 :cardid 信用卡表id
	 * key2:acqcode 通道编号
	 * key3:smsseq 短信序列号
	 * key4:smscode 短信验证码
	 * key5:dsorderid 
	 * @return
	 */
	public Map <String,String> bindAcq(@RequestBody Map<String,String> map) {
		Map <String,String> reMap = new HashMap<>();
		String params = "cardid="+map.get("cardid")+"&acqcode="+map.get("acqcode")
						+"&smsseq="+map.get("smsseq")+"&smscode="+map.get("smscode")
						+"&bindid="+map.get("bindid")+"&dsorderid="+map.get("dsorderid")
						+"&sign="+StringUtils.getSign();
		String result = HttpUtils.sendGet(Constans.SUBMIT_OPEN_ACQ_URL, params);
		JSONObject fromObject = JSONObject.fromObject(result);
		reMap.put("apistatus", fromObject.getString("apistatus"));
		reMap.put("apimsg", fromObject.getString("apimsg"));
		return reMap;
	}
	
	/**
	 * 创建计划
	 * 
	 * @param isoReq
	 *  String merchantNo = (String) map.get("42"); //用户编号
		String cityCode = (String) map.get("422");// 城市编码 例如湖北省-武汉市
	 * 	String planMoney = (String) map.get("8");//计划还款金额
		String dateStr = (String) map.get("10");//时间字符串
		String cardNo = (String) map.get("11");//卡号
		String second = (String) map.get("7");// 每天的笔数
		acqCode 通道编号
	 * @return
	 * @throws Exception
	 */
	/**
	 * @param map
	 * @return
	 * @throws Exception
	 */
	private Map<String, Object> createPlan(Map<String, Object> map,String acqCode) throws Exception {
		String merchantNo = (String) map.get("42");
		String cityCode = (String) map.get("422");// 城市编码
		HatchetMerchant mer = merchantService.selectHatchetMerchantByMerchantNo(merchantNo);
		BigDecimal rate = new BigDecimal("0");
		BigDecimal pro = new BigDecimal("0");
		String ratePro = mer.getYkRate();
		if (!ratePro.contains("+")) { 
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "请联系系统管理员设置代还手续费");
			return map;
		} else {
			rate = new BigDecimal(ratePro.split("[+]")[0]);
			pro = new BigDecimal(ratePro.split("[+]")[1]);
		}
		/*boolean isGround = true; // 是否允许落地
		BigDecimal bigMoney = new BigDecimal("1000"); // 落地的最大金额
		BigDecimal groundRate = rate; // 落地费率
		BigDecimal groundPro = pro; // 落地手续费
		int firststartTime = 7; // 每天第一笔的开始时间，10代表10点
		int timeInterval = 14; // 一天计划执行时间的跨度，6代表6小时
*/	/*	int saleNum = Integer.valueOf((String) map.get("9")); // 消费的笔数：0代表随机消费笔数，1代表消费1笔还一笔，2代表消费2笔还一笔，3代表消费3笔还一笔
*/		BigDecimal divisor = new BigDecimal(100);
		String current_temp_velve1 = "0.79";
		String current_temp_velve2 = "0.74";
		String current_temp_velve3 = "0.60";
		BigDecimal _tmprate = new BigDecimal(current_temp_velve1).divide(divisor);
		if ("3".equals(mer.getLEVEL())||("2".equals(mer.getLEVEL())&&StringUtils.isNotNull(mer.getSubmitReexamineTime()))){
		   _tmprate = new BigDecimal(current_temp_velve3).divide(divisor);
		  } else if ("2".equals(mer.getLEVEL()) && StringUtils.isNull(mer.getSubmitReexamineTime())) {
		   _tmprate = new BigDecimal(current_temp_velve2).divide(divisor);
		  }
		String planMoney = (String) map.get("8");
		String dateStr = (String) map.get("10");
		String cardNo = (String) map.get("11");
		String second = (String) map.get("7");// 每天的笔数
		// 根据预估费率，计算出预估周转金
		BigDecimal calculateZhj = null;
		try {
			calculateZhj = PlanGenner.calculateZhj(planMoney, dateStr, second, _tmprate);
			System.out.println("BigDecimal calculateZhj:" + calculateZhj);
		} catch (Exception e1) {
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "请调整还款金额或还款日期重新计算，可能原因是还款金额过少且还款天数过多！");
			return map;
		}
		
		/*//通过银行卡号查询信用卡信息
		HatchetMerchantIncreaseLimit merchantIncreaseLimit =limtService.selectHatchetMerchantIncreaseLimitByCardNo(cardNo);
		String bankCode = merchantIncreaseLimit.getBankName();
		HatchetIssBank bank = issBankService.selectHatchetIssBankByBankCode(bankCode);
		String bankname = bank.getShortCnName();
		// 这里根据周转金大小，判定是该走大额通道还是小额通道
		boolean issmall = calculateZhj.compareTo(bigMoney) < 1;
		//0.3小额  0.4大额
		String f_feilv = issmall ? "0.3" : "0.4";
		String bank_notsupport = issmall ? "加大还款金额" : "减小还款金额";
		//按优先级查询通道
		HatchetAcq acqParam = new HatchetAcq();
		acqParam.setEmployStatus("10A");
		acqParam.setRspcdRevert(f_feilv);
		List<HatchetAcq> acqs = acqService.selectHatchetAcqListByPriority(acqParam);
		// LinkedHashMap使通道的顺序优先级有保障
		Map<String, String> acqmap = new LinkedHashMap<String, String>();
		// 存储通道对象
		Map<String, HatchetAcq> acq_object = new LinkedHashMap<String, HatchetAcq>();
		if (StringUtils.isEmpty(acqs)) {
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "抱歉，系统内部异常，暂无可用通道，请联系客服！");
			return map;
		}
		String allcodes = "";
		String allbanks = "";
		boolean supportChangeToKFTsmall = isSupportChangeToKFTsmall(mer, merchantIncreaseLimit);
		for (HatchetAcq acq : acqs) {
			// 如果不支持快付通小额追加计划，且当前循环的通道为快付通小额，则直接跳过，不让快付通加入的种子通道中，因为加入进去也是没用的（因为会交易消费单日超额5000），无法进行下一步创建的
			// 这里有个情况需要考虑，快付通小额单日单人交易限额5000元，所有需要询问系统是否支持继续创建快付通小额计划！
			if (!supportChangeToKFTsmall && acq.getAcqCode().equals(PropertiesConst.acq_code_kft8084_small)) {
				continue;
			}
			acqmap.put(acq.getAcqCode(), acq.getProcesscdResign());
			acq_object.put(acq.getAcqCode(), acq);
			allcodes += acq.getAcqCode() + ",";
			allbanks += acq.getProcesscdResign() + ",";
		}
		// 根据储蓄卡名字获取支持通道
		System.out.println("bankname:" + bankname);
		String supportacqcodes = PlanGenner.searchAcqCode(acqmap, bankname);
		if (org.apache.commons.lang3.StringUtils.isBlank(supportacqcodes)) {
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "抱歉该信用卡暂不支持，请更换信用卡或者" + bank_notsupport);
			return map;
		}
		String[] _supportacqcodes = supportacqcodes.split(",");
		// 这里检测通道是否开通
		String status = merchantIncreaseLimit.getSTATUS();
		if (!issmall) {
			status += PropertiesConst.acq_code_weishua_dre;
		}
		status += PropertiesConst.acq_code_weishua_kuaijie;
		status += PropertiesConst.acq_code_kft8085;
		System.out.println("全部通道：" + allcodes);
		System.out.println("全部支持的通道：" + supportacqcodes);
		String kaitong = "";
		for (String acqcode : _supportacqcodes) {
			if (status.contains(acqcode)) {
				kaitong += acqcode + ",";
			}
		}
		System.out.println("发现合适且已经开通的通道集合：" + kaitong);
		boolean violence_changesmall2kft = violence2Acq("violence_changesmall2kft");
		boolean violence_changebig2kft = violence2Acq("violence_changebig2kft");
		boolean violence_changebig2xs = violence2Acq("violence_changebig2xs");
		// 如果发现广州小额开通了，快付通小额没开通，并且快付通小额支持这个银行，则强制转换使用快付通小额
		if (supportacqcodes.contains(PropertiesConst.acq_code_kft8084_small)) {
			if (violence_changesmall2kft) {
				System.out.println("快付通小额！");
				if (!kaitong.contains(PropertiesConst.acq_code_kft8084_small)) {
					kaitong = "";
					resetcode(_supportacqcodes, PropertiesConst.acq_code_kft8084_small);
					System.out.println(
							"触发了快付通小额强制转换条件，进行了快付通小额暴力优先考虑！暴力优先考虑之后，合适的通道被强制清空，要求用户必须开通快付通小额！" + _supportacqcodes[0]);
				} else {
					kaitong = PropertiesConst.acq_code_kft8084_small + "," + kaitong;
				}
			}
		}
		if (supportacqcodes.contains(PropertiesConst.acq_code_kft8083_big)) {
			if (violence_changebig2kft) {
				System.out.println("快付通大额！");
				if (!kaitong.contains(PropertiesConst.acq_code_kft8083_big)) {
					kaitong = "";
					resetcode(_supportacqcodes, PropertiesConst.acq_code_kft8083_big);
					System.out.println(
							"触发了快付通大额强制转换条件，进行了快付通大额暴力优先考虑！暴力优先考虑之后，合适的通道被强制清空，要求用户必须开通快付通大额！" + _supportacqcodes[0]);
				} else {
					kaitong = PropertiesConst.acq_code_kft8083_big + "," + kaitong;
				}
			}
		}
		if (supportacqcodes.contains(PropertiesConst.acq_code_yixian_xs8087)) {
			if (violence_changebig2xs) {
				System.out.println("优先新生大额！");
				if (!kaitong.contains(PropertiesConst.acq_code_yixian_xs8087)) {
					kaitong = "";
					resetcode(_supportacqcodes, PropertiesConst.acq_code_yixian_xs8087);
					System.out.println(
							"触发了新生大额强制转换条件，进行了新生大额暴力优先考虑！暴力优先考虑之后，合适的通道被强制清空，要求用户必须开通新生大额！" + _supportacqcodes[0]);
				} else {
					kaitong = PropertiesConst.acq_code_yixian_xs8087 + "," + kaitong;
				}
			}
		}
		if (org.apache.commons.lang3.StringUtils.isBlank(kaitong)) {// 所有通道均未开通，则优先开通第一个通道
			String not_kt_code = _supportacqcodes[0];
			if (not_kt_code.equals(PropertiesConst.acq_code_weishua_small)) {
				map.put("43", mer.getID());
				map.put("45", cardNo);
				map.put("46", merchantIncreaseLimit.getBankPhone());
				map.put("48", merchantIncreaseLimit.getCvn());
				map.put("49",not_kt_code);
				//
				map = bindCardWeishua(map);
				// 中途增加拦截，判断广州通道是否正常获取到了链接，如果没获取到到，则替换为第二个通道（如果有第二个通道到话），反正直接打回让客户修改还款金额
				if (!"00".equals(map.get("39"))) {
					if (_supportacqcodes.length > 1) {
						not_kt_code = _supportacqcodes[1];
					} else {
						map.put("status",BusinessStatus.FAIL);
						map.put("msg", "抱歉该信用卡暂不支持，请更换信用卡或者" + bank_notsupport);
						return map;
					}
				}
			} else if (PropertiesConst.acq_code_kft8083_big.equals(not_kt_code)
					|| PropertiesConst.acq_code_kft8084_small.equals(not_kt_code)
					|| PropertiesConst.acq_code_kft8085.equals(not_kt_code)) {
			} else if (not_kt_code.equals(PropertiesConst.acq_code_yixian_xs8087)) {
//				isoReq.set(43, mer.getId());
//				isoReq.set(45, cardNo);
//				isoReq.set(46, merchantIncreaseLimit.getBankPhone());
//				isoReq.set(48, merchantIncreaseLimit.getCvn());
//				isoReq.set(49, not_kt_code);
//				isoReq = bankbindService.bindCardWeishua(isoReq);
			}
			if (!"00".equals(map.get("40"))) {
				map.put("391", not_kt_code);// 需要开通的通道
				map.put("392", acq_object.get(not_kt_code).getRspcdResign());// 通道开通方式
				map.put("393", merchantIncreaseLimit.getBankPhone());// 预留手机号码
				String sbigorsmall = issmall ? "小额" : "大额";
				map.put("394", "您需要先开通银联" + sbigorsmall + "支付业务才能制定计划，是否立即开通？");// 预留手机号码
				map.put("36", "0");
				map.put("39", "00");
				return map;
			} else {
				kaitong = not_kt_code;
			}
		}
		map.put("36", "1");
		String kt_acq = kaitong.split(",")[0];
		System.out.println("千辛万苦终于找到你" + kt_acq);*/
		HatchetAcq hatchetAcq =	acqService.selectHatchetByAcqCode(acqCode); //通道
		boolean issmall = false;
		if (StringUtils.isNotNull(hatchetAcq)) {
			if ("0.3".equals(hatchetAcq.getRspcdRevert())) {
				//小额
				issmall =true;
			}else if ("0.4".equals(hatchetAcq.getRspcdRevert())) {
				//大额
				issmall =false;
			}else {
				map.put("status",BusinessStatus.FAIL);
				map.put("msg", "没找到合适的通道");
				return map;
			}
		} else {
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "没找到合适的通道");
			return map;
		}
		
		//开通方式
		System.out.println("开通方式"+hatchetAcq.getRspcdResign());
		//String selectAcqInfo = "SELECT * from HATCHET_SYSTEM_CONFIG where config_code=?";
		//HatchetSystemConfig config = dao.findFirst(HatchetSystemConfig.class, selectAcqInfo, mer.getProductShort());
		HatchetSystemConfig configparam = new HatchetSystemConfig();
		configparam.setConfigCode(mer.getProductShort());
		List<HatchetSystemConfig> systemConfigs = systemConfigService.selectHatchetSystemConfigList(configparam);
		HatchetSystemConfig config = systemConfigs.get(0);
		JSONObject wkJson = JSONObject.fromObject(config.getConfigValue());
		JSONArray arrayRate = JSONArray.fromObject(wkJson.getString("YKRate"));
		for (int j = 0; j < arrayRate.size(); j++) {
			String acqName = arrayRate.getJSONObject(j).getString("acqName");
			JSONObject rateJson = JSONObject.fromObject(arrayRate.getJSONObject(j).getString("acqRate"));
			if (acqName.contains(acqCode)) {
				pro = new BigDecimal(rateJson.getString("procedureFee"));
				String level = mer.getLEVEL();
				if (!StringUtils.isEmpty(level) && "1".equals(level)) {// 普通用户
					rate = new BigDecimal(rateJson.getString("putongjifen"));
				} else if (!StringUtils.isEmpty(level) && "2".equals(level)) {// 高级用户
					rate = new BigDecimal(rateJson.getString("gaojijifen"));
				} else {// 钻石用户
					rate = new BigDecimal(rateJson.getString("zuanshijifen"));
				}
			}
		}
		String level = mer.getLEVEL();
		String bigfl = "0.60%";
		  rate = new BigDecimal("0.60");
		  if (level.equals("1")) {
		   bigfl = "0.79%";
		   rate = new BigDecimal("0.79");
		  } else if (level.equals("2")) {
		   bigfl = "0.74%";
		   rate = new BigDecimal("0.74");
		  }
		  if (level.equals("2") && mer.getSubmitReexamineTime() != null) {
		   bigfl = "0.60%";
		   rate = new BigDecimal("0.60");
		  }
		map.put("acqCode", acqCode);
		String sbigorsmall = issmall ? "小额" : "大额";
		map.put("rate", rate.setScale(2) + "%");//当前费率
		map.put("sbigorsmall", sbigorsmall);//大额还是小额
		map.put("bigfl", bigfl);//大额费率
		map.put("smallfl", bigfl);//统一费率
		rate = rate.divide(divisor);
//		String planMoney = isoReq.getString(8);
//		String cityCode = isoReq.getString(422);
//		String dateStr = isoReq.getString(10);
//		String second = isoReq.getString(7);// 每天的笔数
//		String cardNo = isoReq.getString(11);
		String bindID = (String) map.get("12");// 信用卡id
		Map<String, Object> myplan = null;
		try {
			myplan = PlanGenner.grennerPlan(planMoney, dateStr, second, rate);
		} catch (Exception e) {
			map.put("status",BusinessStatus.FAIL);
			map.put("msg", "请调整还款金额或还款日期重新计算，可能原因是还款金额过少且还款天数过多！");
			return map;
		}
		BigDecimal small = (BigDecimal) myplan.get("sale_min");
		BigDecimal big = (BigDecimal) myplan.get("sale_max");
		BigDecimal free_free = (BigDecimal) myplan.get("free_free");
		List<PlanGennerItem> items = (List<PlanGennerItem>) myplan.get("items");
		BigDecimal total = (BigDecimal) myplan.get("total_free"); // 还款总金额
		BigDecimal rate_money = (BigDecimal) myplan.get("rate_money"); // 费率手续费
		BigDecimal toalFree = (BigDecimal) myplan.get("total_free"); // 总费用
		BigDecimal total_zhj = (BigDecimal) myplan.get("total_zhj");
		BigDecimal times_money = (BigDecimal) myplan.get("times_money");// 笔数费
		ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		Map<String, Object> map1 = new HashMap<>();
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		if (small.compareTo(new BigDecimal(100)) == -1) {
			map1.put("status",BusinessStatus.FAIL);
			map1.put("msg", "单笔消费不得低于100元，请调整重新制定！");
			return map1;
		}
		if (big.compareTo(new BigDecimal(50000)) == 1) {
			map1.put("status",BusinessStatus.FAIL);
			map1.put("msg", "单笔消费不得超过5万元，请调整重新制定！");
			return map1;
		}
		String acq_code = acqCode;
		System.out.println("前台传入cityCode:" + cityCode);
		String province_city =cityCode;
		System.out.println("匹配结果province_city:" + province_city);
//		String provinceName = province_city.split("-")[0];
		String cityName = province_city.split("-")[1];
		String acqCityCode = "";
		System.out.println("决定使用通道acq_code：" + acq_code);
		if (PropertiesConst.acq_code_weishua_small.equals(acq_code)
				|| PropertiesConst.acq_code_weishua_dre.equals(acq_code)
				|| PropertiesConst.ACQ_CODE_HUANQIUHUIJU_LARGE.equals(acq_code)
				|| PropertiesConst.ACQ_CODE_HUANQIUHUIJU_SMALL.equals(acq_code)) {
			List<ProductBean> productBeans = ProductUtil.getProducts();
			List<FrontProductBean> fronts = ProductUtil.product2Front(productBeans);
			List<RegionBean> regions = CityUtil.getRegion();
			// 双向查找
			for (RegionBean rg : regions) {
				if (rg.getRegionName().contains(cityName)) {
					acqCityCode = rg.getRegionCode();
				}
			}
			if (org.apache.commons.lang3.StringUtils.isBlank(acqCityCode)) {
				for (RegionBean rg : regions) {
					if (cityName.contains(rg.getRegionName())) {
						acqCityCode = rg.getRegionCode();
					}
				}
			}
			Collections.shuffle(fronts);
			int index = 0;
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					FrontProductBean frontProductBean = fronts.get(index);
					index++;
					if (index == fronts.size()) {
						index = 0;
						Collections.shuffle(fronts);
					}
					map1.put("cityindustry", frontProductBean.getAcqMerchantNo());
					map1.put("cityindustryName", frontProductBean.getAcqMerchantName());
					map1.put("customizecity", province_city);
				}
				map1.put("citycode", acqCityCode);
				list.add(map1);
			}
		} else if (PropertiesConst.acq_code_weishua_small.equals(acq_code)
				|| PropertiesConst.acq_code_weishua_dre.equals(acq_code)) {
			List<ProductBean> productBeans = ProductUtil.getProducts();
			List<FrontProductBean> fronts = ProductUtil.product2Front(productBeans);
			List<RegionBean> regions = CityUtil.getRegion();
			// 双向查找
			for (RegionBean rg : regions) {
				if (rg.getRegionName().contains(cityName)) {
					acqCityCode = rg.getRegionCode();
				}
			}
			if (org.apache.commons.lang3.StringUtils.isBlank(acqCityCode)) {
				for (RegionBean rg : regions) {
					if (cityName.contains(rg.getRegionName())) {
						acqCityCode = rg.getRegionCode();
					}
				}
			}
			Collections.shuffle(fronts);
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					FrontProductBean frontProductBean = fronts.get(new Random().nextInt(fronts.size()));
					map1.put("cityindustry", frontProductBean.getAcqMerchantNo());
					map1.put("cityindustryName", frontProductBean.getAcqMerchantName());
					map1.put("customizecity", province_city);
				}
				map1.put("citycode", acqCityCode);
				list.add(map1);
			}
		} else if (PropertiesConst.acq_code_kft8083_big.equals(acq_code)
				|| PropertiesConst.acq_code_kft8084_small.equals(acq_code)) {
			List<RegionBean> regions = CityUtil.getRegionKFT();
			// 双向查找
			for (RegionBean rg : regions) {
				if (rg.getRegionName().contains(cityName)) {
					acqCityCode = rg.getRegionCode();
				}
			}
			if (org.apache.commons.lang3.StringUtils.isBlank(acqCityCode)) {
				for (RegionBean rg : regions) {
					if (cityName.contains(rg.getRegionName())) {
						acqCityCode = rg.getRegionCode();
					}
				}
			}
			String de = "小额";
			if (PropertiesConst.acq_code_kft8083_big.equals(acq_code)) {
				de = "大额";
			}
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					map1.put("cityindustry", acqCityCode);
					map1.put("cityindustryName", "银联" + de + "落地");
					map1.put("customizecity", province_city);
				}
				map1.put("citycode", acqCityCode);
				list.add(map1);
			}
		} else if (PropertiesConst.acq_code_yixian_xs8087.equals(acq_code)) {
			// 这里进行银联落地选择城市和商户
			List<ProductBean> productBeans = CityUtil.getRegionYX(cityName,acq_code);
			if (productBeans == null || productBeans.size() < items.size() / 2) {
				map.put("status",BusinessStatus.FAIL);
				map.put("msg", "抱歉，您选择的城市当前落地城市商户数还不是很多，请更换城市重新计算周转金！");
				return map;
			}
			Collections.shuffle(productBeans);
			int index = 0;
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					ProductBean frontProductBean = productBeans.get(index);
					index++;
					if (index == productBeans.size()) {
						index = 0;
						Collections.shuffle(productBeans);
					}
					map1.put("cityindustry", frontProductBean.getMcc());
					map1.put("cityindustryName", frontProductBean.getName());
					map1.put("customizecity", province_city);
				}
				// 新生不需要citycode，交易时候传入商户编号即可，所有这个citycode随便设置，无需进行匹配寻找
				map1.put("citycode", cityName);
				list.add(map1);
			}
		}   else if (PropertiesConst.ACQ_CODE_HD.equals(acq_code)) {
			List<RegionBean> regions = CityUtil.getRegionHD();
			// 双向查找
			for (RegionBean rg : regions) {
				if (rg.getRegionName().contains(cityName)) {
					acqCityCode = rg.getRegionCode();
				}
			}
			if (org.apache.commons.lang3.StringUtils.isBlank(acqCityCode)) {
				for (RegionBean rg : regions) {
					if (cityName.contains(rg.getRegionName())) {
						acqCityCode = rg.getRegionCode();
					}
				}
			}
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					map1.put("cityindustry", acqCityCode);
					map1.put("cityindustryName", "银联小额落地");
					map1.put("customizecity", province_city);
				}
				map1.put("citycode", acqCityCode);
				list.add(map1);
			}
		} else if (PropertiesConst.acq_code_yixian_xs8087.equals(acq_code)
				|| PropertiesConst.acq_code_yixian_8063.equals(acq_code)) {
			// 这里进行银联落地选择城市和商户
			List<ProductBean> productBeans = CityUtil.getRegionYX(cityName, acq_code);
			if (productBeans == null || productBeans.size() < items.size() / 4) {
				map.put("status",BusinessStatus.FAIL);
				map.put("msg", "抱歉，您选择的城市当前落地城市商户数还不是很多，请更换城市重新计算周转金！");
				return map;
			}
			Collections.shuffle(productBeans);
			int index = 0;
			for (PlanGennerItem item : items) {
				map1 = new HashMap<String, Object>();
				map1.put("money", item.getMoney());
				String type = item.getType();
				map1.put("type", type);
				map1.put("status", "10A");
				map1.put("cardNo", cardNo);
				map1.put("bindid", bindID);
				map1.put("time", dateFormat.format(item.getTime()));
				map1.put("groupNum", item.getGroup());
				if (type.equals(PropertiesConst.SALE)) {
					ProductBean frontProductBean = productBeans.get(index);
					index++;
					if (index == productBeans.size()) {
						index = 0;
						Collections.shuffle(productBeans);
					}
					map1.put("cityindustry", frontProductBean.getMcc());
					map1.put("cityindustryName", frontProductBean.getName());
					map1.put("customizecity", province_city);
				}
				// 新生不需要citycode，交易时候传入商户编号即可，所有这个citycode随便设置，无需进行匹配寻找
				map1.put("citycode", cityName);
				list.add(map1);
			}
			//else if (PropertiesConst.ACQ_CODE_TONGLIAN.equals(acq_code))
		}else {
			   acqCityCode = CpcUtils.findCodeByName(cityName);
			   for (PlanGennerItem item : items) {
				   map1 = new HashMap<String, Object>();
				   map1.put("money", item.getMoney());
				    String type = item.getType();
				    map1.put("type", type);
				    map1.put("status", "10A");
				    map1.put("cardNo", cardNo);
				    map1.put("bindid", bindID);
				    map1.put("time", dateFormat.format(item.getTime()));
				    map1.put("groupNum", item.getGroup());
				    if (type.equals(PropertiesConst.SALE)) {
				    	map1.put("cityindustry", acqCityCode);
				    	map1.put("cityindustryName", "通联小额落地");
				    	map1.put("customizecity", province_city);
				    }
				    map1.put("citycode", acqCityCode);
				    list.add(map1);
		    }
		  }
		map.put("total_zhj", total_zhj.toString());// 周转金
		map.put("rate_money", rate_money.toString());//手续费
		map.put("times_money", times_money.toString());//笔数费
		map.put("toalFree", toalFree.toString());//总手续费
		map.put("free_free", free_free.toString());//手续费的费用
		map.put("second", second);//每天的次数
		map.put("plan_time", myplan.get("plan_time") + "");//日期区间

		
		for (Map<String, Object> map2 : list) {
			System.out.println(map2.toString());
		}
		map.put("items", list);//小计划列表
		map.put("acq_code", acq_code);//通道编号
		map.put("status", BusinessStatus.SUCCESS);
		System.out.println(map.toString());
		return map;
	}
}
